import Vue from "vue";
// Cookies 数据
import Cookies from "js-cookie";

// element 组件库
import Element from "element-ui";
import "./assets/styles/element-variables.scss";
// 设置 Input 组件默认 clearable 属性
Element.Input.props.clearable.default = true;

// 设置 Select 组件默认 clearable、filterable 属性
Element.Select.props.clearable = {type: Boolean, default: true}
Element.Select.props.filterable = {type: Boolean, default: true}
// 动画
import 'animate.css';
// 全局样式
import "@/assets/styles/index.scss"; // global css
import "@/assets/styles/css.scss"; // 全局css css
// 常规项
import App from "./App";
import store from "./store";
import router from "./router";
// 指令
import directive from "./directive"; // directive

/* 全局 Loading */
import { startLoading, endLoading } from "@/plugins/loading";
Vue.prototype.$startLoading = startLoading;
Vue.prototype.$endLoading = endLoading;
// 全局方法
import { resetForm } from "@/utils/utils";
import * as utils from "@/utils/utils";
Vue.prototype.$utils = utils;
// 请求（其他情况使用）
import axios from "axios";
Vue.prototype.$axios = axios;
// 全局 icon
import "./assets/icons"; // icon
import "./permission"; // permission control
 // 全局组件
import plugins from "./plugins"; // plugins
import "@/plugins/components";

Vue.use(directive);
Vue.use(plugins);

// 全局方法挂载
Vue.prototype.resetForm = resetForm;

// 请求 URl
import config from "@/utils/config.js";
Vue.prototype.$config = config;

// 请求工具栏
import { HandleRequestSubmit, HandleRequestQuery } from "@/utils/request.js"
Vue.prototype.HandleRequestSubmit = HandleRequestSubmit;
Vue.prototype.HandleRequestQuery = HandleRequestQuery;

// 全局 请求体
import * as http from "@/api/api.js";
Vue.prototype.$http = http;

// 全局 mixin
import mixin from "@/plugins/mixin/index";
Vue.mixin(mixin);

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

Vue.use(Element, {
  size: Cookies.get("size") || "small", // set element-ui default size
});

Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
